home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Shareware
/
WorkTime 4.14
/
worktime.exe
/
{app}
/
db
/
db_update.ini
next >
Wrap
INI File
|
2008-01-20
|
5KB
|
184 lines
[002]
CREATE TABLE SECURITY (
ID INTEGER NOT NULL,
USER_ID INTEGER,
DATA_VALUE TLONGNAME);
alter table SECURITY
add constraint PK_SECURITY
primary key (ID);
CREATE GENERATOR GEN_SECURITY_ID;
SET TERM ^ ;
CREATE TRIGGER SECURITY_BI FOR SECURITY
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(GEN_SECURITY_ID,1);
END
^
SET TERM ; ^
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '002');
[003]
delete from config where name='admin';
INSERT INTO SECURITY (ID) VALUES (-10);
INSERT INTO SECURITY (ID) VALUES (-1);
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '003');
[004]
SET TERM ^ ;
CREATE PROCEDURE CONVERTINTTOTIMESTR (
SECONDS INTEGER)
RETURNS (
FULLTIMESTR CHAR(15))
AS
DECLARE VARIABLE IHOUR INTEGER;
DECLARE VARIABLE IMIN INTEGER;
DECLARE VARIABLE SHOUR CHAR(9);
DECLARE VARIABLE SMIN CHAR(2);
DECLARE VARIABLE SSEC CHAR(2);
begin
iHour = Seconds/60/60;
Seconds = Seconds - (Seconds/60/60)*60*60;
iMin = Seconds/60;
Seconds = Seconds - (Seconds/60)*60;
sMin = cast(iMin as char(2));
if (iMin<10) then sMin = '0' || sMin;
sSec = cast(Seconds as char(2));
if (Seconds<10) then sSec = '0' || sSec;
if (iHour<10) then FullTimeStr = '0'||cast(iHour as char(1)) || ':' || sMin || ':' || sSec;
else if (iHour<100) then FullTimeStr = cast(iHour as char(2)) || ':' || sMin || ':' || sSec;
else if (iHour<1000) then FullTimeStr = cast(iHour as char(3)) || ':' || sMin || ':' || sSec;
else if (iHour<10000) then FullTimeStr = cast(iHour as char(4)) || ':' || sMin || ':' || sSec;
else if (iHour<100000) then FullTimeStr = cast(iHour as char(5)) || ':' || sMin || ':' || sSec;
else FullTimeStr = cast(iHour as char(9)) || ':' || sMin || ':' || sSec;
suspend;
end
^
SET TERM ; ^
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '004');
[005]
DROP TRIGGER DETAIL_DAY_AI_UPDATE_QSTAT;
DROP TRIGGER SESSION_AI_UPDATE_QSTAT;
DROP INDEX IDX_PROJECT_TOTAL_WORKTIME_DESC;
DROP INDEX IDX_ACTIVITY_TOTAL_WORKTIME_DES;
DROP INDEX IDX_USER_TOTAL_WORKTIME_DESC;
DROP INDEX IDX_WORKSTATION_TOTAL_WORKTIMED;
DROP INDEX IDX_APP_TOTAL_WORKTIME_DESC;
DROP INDEX IDX_DOC_TOTAL_WORKTIME_DESC;
ALTER TABLE PROJECT DROP TOTAL_WORKTIME;
ALTER TABLE PROJECT DROP LAST_USED;
ALTER TABLE ACTIVITY DROP TOTAL_WORKTIME;
ALTER TABLE ACTIVITY DROP LAST_USED;
ALTER TABLE USERR DROP TOTAL_WORKTIME;
ALTER TABLE USERR DROP LAST_USED;
ALTER TABLE WORKSTATION DROP TOTAL_WORKTIME;
ALTER TABLE WORKSTATION DROP LAST_USED;
ALTER TABLE APP DROP TOTAL_WORKTIME;
ALTER TABLE APP DROP LAST_USED;
ALTER TABLE DOC DROP TOTAL_WORKTIME;
ALTER TABLE DOC DROP LAST_USED;
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '005');
[006]
ALTER TABLE SESSION ADD GROUP_SESSION_ID INTEGER;
CREATE GENERATOR GEN_NOTE_ID;
CREATE TABLE NOTE (
ID INTEGER NOT NULL,
GROUP_SESSION_ID INTEGER,
NOTE_TEXT VARCHAR(10000)
);
ALTER TABLE NOTE ADD CONSTRAINT PK_NOTE PRIMARY KEY (ID);
CREATE INDEX IDX_NOTE_GROUP_SESSION_ID ON NOTE (GROUP_SESSION_ID);
SET TERM ^ ;
CREATE TRIGGER NOTE_BI FOR NOTE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(GEN_NOTE_ID,1);
END
^
SET TERM ; ^
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '006');
[007]
update session set GROUP_SESSION_ID=id where GROUP_SESSION_ID is null;
SET TERM ^ ;
ALTER PROCEDURE UPDATE_SESSION (
MODE_ID INTEGER,
PROJECT_ID INTEGER,
ACTIVITY_ID INTEGER,
USER_ID INTEGER,
WORKSTATION_ID INTEGER,
DATEE DATE,
BEGIN_TIME TIMESTAMP,
END_TIME TIMESTAMP,
WORKTIME INTEGER,
ROLLBACK_INDICATOR INTEGER)
RETURNS (
ID INTEGER)
AS
DECLARE VARIABLE DB_END_TIME TIMESTAMP;
DECLARE VARIABLE iGroupSessionID INTEGER;
begin
for select s.id, s.end_time from session s
where s.datee=:datee and s.mode_id = :mode_id and s.project_id = :project_id and s.activity_id = :activity_id
and s.user_id = :user_id and s.workstation_id = :workstation_id and s.begin_time = :begin_time
into :id, :DB_END_TIME do
begin
if ((:Rollback_Indicator<>1) and (:end_time < DB_END_TIME))
then id = -1;
else update session set end_time=:end_time, worktime=:worktime where id=:id;
exit;
end
if (id is NULL) then
begin
id = GEN_ID(GEN_SESSION_ID,1);
select min(s.GROUP_SESSION_ID) from session s where
s.datee=:datee and s.mode_id < 5 and s.project_id = :project_id and s.activity_id = :activity_id and
s.user_id = :user_id and s.workstation_id = :workstation_id and s.end_time = :begin_time
into :iGroupSessionID;
if (iGroupSessionID is NULL) then iGroupSessionID = id;
INSERT INTO SESSION (ID,MODE_ID,PROJECT_ID,ACTIVITY_ID,USER_ID,WORKSTATION_ID,DATEE,BEGIN_TIME,END_TIME,WORKTIME,GROUP_SESSION_ID)
VALUES (:ID,:MODE_ID,:PROJECT_ID,:ACTIVITY_ID,:USER_ID,:WORKSTATION_ID,:DATEE,:BEGIN_TIME,:END_TIME,:WORKTIME, :iGroupSessionID);
end
end
^
SET TERM ; ^
EXECUTE PROCEDURE UPDATE_CONFIG('db_ver', '007');